package com.sun.mychat.config.controller;

import com.sun.mychat.config.pojo.Record;
import com.sun.mychat.config.pojo.User;
import com.sun.mychat.config.service.RecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/record")
@Api(description = "聊天信息")
public class RecordController {
    @Autowired
    private RecordService recordService;

    @ApiOperation(value = "添加聊天记录")
    @PostMapping("/add")
    public int add(@RequestBody Record record){
        return recordService.add(record);
    }

    @ApiOperation(value = "查看聊天记录")
    @PostMapping("/list")
    public List<Record> login(@RequestBody User user){
        return recordService.list(user);
    }
}
